<template>
    <div class="flightDateTwo">
      <myDatePickerTwo  centerInfo="选择往返日期" tipDivTextStart='去程' tipDivTextEnd="返程" @dateClick="dateClick" @dateBack="dateBack"  :start="start" :end="end" :max="maxProp" :toastInfoArr="toastInfoArr"></myDatePickerTwo>
    </div>
</template>

<script>
  import myDatePickerTwo from 'components/myDatePickerTwo.vue';

   export default{
     data(){
       return{
         back:'',
         toastInfoArr:['选择去程日期','选择返程日期']
       }
     },
     mounted(){
       this.back = this.$route.params.back;
     },
     methods:{
       dateBack(){
         this.$router.go(-1);
       },
       dateClick(msg){
         this.$store.state.flight.fromDate = msg.startTime;
         this.$store.state.flight.returnTimes = msg.endTime;

         this.$store.state.flight.month = msg.startTime.substring(5, 7);
         this.$store.state.flight.day = msg.startTime.substring(8, 10);
         this.$store.state.flight.Sunday = msg.startTime.weekGet();

         this.$router.go(-1);
         this.$router.replace({
           name:this.back,
           params:{
             date:msg,
             dateBack:true
           }
         })
       }
     },
     computed:{
       start(){
         return this.$store.state.flight.fromDate
       },
       end(){
         return this.$store.state.flight.returnTimes
       },
       maxProp(){
         var k = '364'.future();
         return k ;
       },
     },
     watch:{},
     components:{myDatePickerTwo},
   }
</script>
